class UserObserver < ActiveRecord::Observer
  def after_create(user)
    UserMailer.deliver_signup_confirmation(user) unless user.facebook_user?
  end
  
  def after_destroy(user)
    remove_user_campaigns(user)
  end
  
  private 
  def remove_user_campaigns(user)
    UserCampaign.destroy_all("user_id=#{user.id}")
  end
end